#include "frameshadowplugin.h"

class FrameShadowPlugin;

K_PLUGIN_FACTORY( KDCMenuPluginFactory, registerPlugin< FrameShadowPlugin >(); )
K_EXPORT_PLUGIN( KDCMenuPluginFactory( "FrameShadowPlugin" ) )

#include "frameshadowjob.h"

#include <interfaces/kdcapplicationinterface.h>
KDCApplicationInterface *gAppInterface;

FrameShadowPlugin::FrameShadowPlugin( QObject *parent, const QVariantList &args ) : FramePluginInterface( parent ), pInfo( KPluginInfo("frameshadowplugin.desktop", "services") )
{
	Q_UNUSED( args )
	gAppInterface = NULL;
}

FrameShadowPlugin::~FrameShadowPlugin()
{

}

const KPluginInfo& FrameShadowPlugin::info() const
{
	return pInfo;
}

QPixmap FrameShadowPlugin::preview() const
{
	QString path;
	if ( gAppInterface )
		path = gAppInterface->applicationDataDir() + "/frames/frame_shadow_thumb.png";
	return QPixmap( path );
}

QPixmap FrameShadowPlugin::create( const QPixmap &aInput, int aWidth, int aHeight, QString &aError ) const
{
	FrameShadowJob job( aInput );
	if ( job.exec() )
		return job.resultFrame();
	aError = job.errorText();
	return QPixmap();
}

KDCFrameJobInterface* FrameShadowPlugin::createJob( const QPixmap &aInput, int aWidth, int aHeight ) const
{
	return new FrameShadowJob( aInput );
}


void FrameShadowPlugin::setApplicationInterface( KDCApplicationInterface* aInterface )
{
	gAppInterface = aInterface;
}

